<div class="container" style="padding-top: 50px;">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <form id="post_form" class="form-horizontal" role="form" action="{:U('')}" method="post">
                <input type="hidden" name="id"  value="{$info.id}" id="id" />
                <div class="form-group">
                    <label class="col-sm-2 control-label">退款单号:</label>
                    <div class="col-sm-5">
                        <p class="form-control-static">
                            {$info['refund_no']}
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">订单编号:</label>
                    <div class="col-sm-5">
                        <p class="form-control-static">
                            <a href="{:U('index', ['key'=>$info['order_no']])}">{$info['order_no']}</a>
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">退款类型:</label>
                    <div class="col-sm-5">
                        <p class="form-control-static">
                            {$info['refund_type']}
                        </p>
                    </div>
                </div>
                <notempty name="info['logistics_name']">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">物流公司:</label>
                        <div class="col-sm-5">
                            <p class="form-control-static">
                                {$info['logistics_name']}
                            </p>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">物流单号:</label>
                        <div class="col-sm-5">
                            <p class="form-control-static">
                                {$info['logistics_code']}
                            </p>
                        </div>
                    </div>
                </notempty>
                <div class="form-group">
                    <label class="col-sm-2 control-label">退款商品:</label>
                    <div class="col-sm-5">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th>图片</th>
                                    <th>商品</th>
                                    <th>属性</th>
                                    <th>数量</th>
                                    <th>价格</th>
                                </tr>
                            </thead>
                            <tbody>
                                <volist name="return_goods" id="goods">
                                    <tr>
                                        <td>
                                            <img src="{$goods['listimg']}" width="50px" alt="">
                                        </td>
                                        <td>{$goods['title']}</td>
                                        <td>{$goods['attr_name']}</td>
                                        <td>{$goods['num']}</td>
                                        <td>{$goods['price']}</td>
                                    </tr>
                                </volist>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">申请原因:</label>
                    <div class="col-sm-5">
                        <p class="form-control-static">
                            {$info['reason']}
                        </p>
                    </div>
                </div>
                <notempty name="info['imgs']">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">申请图片:</label>
                        <div class="col-sm-10">
                            <div name="imgs" class="upviewer">
                                <ul>
                                    <notempty name="info['imgs']">
                                        <php>
                                            $info['imgs'] = explode(',', $info['imgs']) ;
                                        </php>
                                        <volist name="info['imgs']" id="img">
                                            <li>
                                                <img src="{$img}">
                                            </li>
                                        </volist>
                                    </notempty>
                                </ul>
                            </div>
                        </div>
                    </div>
                </notempty>
                <div class="form-group">
                    <label class="col-sm-2 control-label">退款金额:</label>
                    <div class="col-sm-5">
                        <p class="form-control-static">
                            <input type="number" class="form-control" id="money" name="money" value="{$info['money']}"/>
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">退款状态:</label>
                    <div class="col-sm-5">
                        <p class="form-control-static">
                            {$info['status_name']}
                        </p>
                    </div>
                </div>
                <if condition="$info['status'] eq 1">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">操作:</label>
                        <div class="col-sm-5">
                            <select name="status" class="form-control">
                                <option value="1">申请中</option>
                                <option value="2">同意</option>
                                <option value="3">拒绝</option>
                            </select>
                        </div>
                        <div class="col-sm-2">售前退款：同意后直接完成，收货退款：同意后需要买家发货</div>
                    </div>
                </if>
                <if condition="$info['status'] eq 4">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">操作:</label>
                        <div class="col-sm-5">
                            <select name="status" class="form-control">
                                <option value="4">待收货</option>
                                <option value="5">完成</option>
                            </select>
                        </div>
                    </div>
                </if>
                <div class="form-group">
                     <label for="inputEmail3" class="col-sm-2 control-label">处理备注:</label>
                    <div class="col-sm-5">
                        <if condition="$info['status'] eq 1">
                            <textarea name="remark" class="form-control" id="" cols="30" rows="3">{$info.remark}</textarea>
                        <else />
                            <p class="form-control-static">{$info.remark}</p>
                        </if>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                         <button type="submit" class="btn btn-primary button" id="baocun">保存</button>
                    </div>
                </div>
                
            </form>
        </div>
</div>
<script>
    $(function () {
        $("#baocun").click(function(){
            var $form = $("#post_form");
            var $data = {};
            var $form_data = $form.serializeArray();
            $.each($form_data, function(k, v){
                $data[v['name']] = v['value'];
            })
            
            $.post($form.attr('action'), $data, function(obj){
                alert(obj.info);
                if(obj.status){
                    if(typeof(obj.url)!= "undefined" && obj.url){
                        location.href = obj.url;
                    }
                }
            })
            return false;
        })
    });
</script>
